package cs.android.view;

import static cs.java.lang.Lang.equalOne;
import static cs.java.lang.Lang.is;

import android.view.KeyEvent;
import android.view.inputmethod.EditorInfo;
import android.widget.TextView.OnEditorActionListener;

public abstract class OnEditorActionAdapter implements OnEditorActionListener {
	protected boolean isSubmitAction(int actionId, KeyEvent event) {
		if (equalOne(actionId, EditorInfo.IME_ACTION_SEARCH, EditorInfo.IME_ACTION_DONE)) return true;
		if (is(event) && event.getAction() == KeyEvent.ACTION_DOWN
				&& event.getKeyCode() == KeyEvent.KEYCODE_ENTER) return true;
		return false;
	}
}
